<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Promise API - reject</title>
</head>
<body>
<script type="text/javascript">
    // let p1 = Promise.resolve("p1");
    let p1 = new Promise((resolve, reject) => {
        setTimeout(() => {
            resolve("p1");
        }, 1000);
    });
    let p2 = Promise.resolve("p2");
    let p3 = Promise.resolve("p3");

    //说明: 返回一个新的 promise, 第一个完成的 promise 的结果状态就是最终的结果状态
    const res = Promise.race([p1, p2, p3]);
    console.log(res);
</script>
</body>
</html>